{% extends "base.html" %}

{% block content %}
<div class="container mt-5">
  <div class="row justify-content-center">
    <div class="col-md-6">
      <div class="card shadow">
        <div class="card-header bg-primary text-white">
          <h4 class="mb-0">管理员登录</h4>
        </div>
        <div class="card-body">
          <form method="POST">
            {{ form.hidden_tag() }}
            
            <div class="mb-3">
              <label for="username" class="form-label">用户名</label>
              {{ form.username(class="form-control", id="username") }}
              {% if form.username.errors %}
                <div class="invalid-feedback d-block">
                  {{ form.username.errors[0] }}
                </div>
              {% endif %}
            </div>

            <div class="mb-3">
              <label for="password" class="form-label">密码</label>
              {{ form.password(class="form-control", id="password") }}
              {% if form.password.errors %}
                <div class="invalid-feedback d-block">
                  {{ form.password.errors[0] }}
                </div>
              {% endif %}
            </div>

            <div class="d-grid gap-2">
              <button type="submit" class="btn btn-primary">登录</button>
              <a href="{{ url_for('index') }}" class="btn btn-secondary">返回首页</a>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}
